//
//  ProductEditRightInput.m
//  AFNetworking
//
//  Created by admin on 2020/4/28.
//

#import "ProductEditRightInput.h"

@implementation ProductEditRightInput


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}
-(void)configUI{
    
    [self.contentView addSubview:self.titleLab];
    [self.contentView addSubview:self.titleLab];
    [self.contentView addSubview:self.inputTF];
}

-(UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [UILabel new];
        _titleLab.font = FONT_SYS14;
        _titleLab.textColor = COLOR_33;
    }
    return _titleLab;
}

-(UIImageView *)notNullIcon{
    if (!_notNullIcon) {
        _notNullIcon = [UIImageView new];
    }
    return _notNullIcon;
}

-(UITextField *)inputTF{
    if (!_inputTF) {
        _inputTF = [UITextField new];
        _inputTF.ug_maximumLimit = 30;
        
    }
    return _inputTF;
}
-(void)reload:(ProductEditData*)data{
    _titleLab.text = data.title;
    _inputTF.placeholder = data.placeholder;
    _inputTF.textAlignment = NSTextAlignmentRight;
    _inputTF.font = FONT_SYS14;
    _inputTF.textColor = COLOR_33;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).mas_offset(KPAND_DEF);
        make.centerY.mas_equalTo(self.contentView);
    }];
    
    [_notNullIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.titleLab.mas_right);
        make.centerY.mas_equalTo(self.contentView);
    }];
    [_inputTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView).mas_offset(-KPAND_DEF);
        make.width.mas_equalTo(KAutoAcale(300));
        make.centerY.mas_equalTo(self.contentView);
    }];
}

@end
